// 点击注册按钮，把数据发送后端
const userName = document.querySelector('#userName'),
	password = document.querySelector('#password')
const submit=document.querySelector('#submit')
console.log(submit)
submit.addEventListener('click', function() {
	const name = userName.value
	const passW = password.value
	console.log('点击了注册')
		// 发送请求
		utils.fetch('../api/user/register.php', {name,passW}).then(resp => {
			console.log('发送了请求')
			if (resp.code === 200) {
				console.log(json_decode(resp.body.msg)+'，即将跳转到首页')
				userName.value = password.value = ''
				setTimeout(() => {
					// location.href='../index.html'
				}, 2000)
			} else {
				console.log(json_decode(resp.body.msg))
				userName.value = password.value = ''
			}
		})
})
